this.view = {extend: "base"}

this.handler = function(){
	
	
	var loginForm = forms.login();
	var registerForm = forms.register();
	
	this.get = function(){
		
		request.attr('user') ?
			request.forward("/home") :
			(function(){
				var errorMessage = loginForm.errorMessage || registerForm.errorMessage;
				errorMessage && $("body").append('<p>' + errorMessage + '</p>');
				$("body").append('<h3>Login</h3>'+loginForm.html()+'<hr/><h3>Register</h3>'+registerForm.html());
			})();
	}
	
	this.post = function(){
		
		actions.loginProcess(loginForm);
		actions.registerProcess(registerForm);
		
		loginForm.pass
		  ?	response.redirect(request.attr("returnUrl") || "/home")
		  :	registerForm.pass
		    ?	response.redirect("/home")
		    :	this.get();
			
	}


}